// 暴露一个对象
export default {
  state: {
    id: 0,
    username: ''
  },
  mutations: {
    setUser(state, user) {
      state.id = user.id
      state.username = user.username
    },
    logout(state) {
      state.id = 0
      state.username = ''
    }
  },
  actions: {
    
  },
  getters: {
    isLogin(state) {
      return state.id !== 0
    }
  },
  // 使多个模块内部名字不会冲突
  namespaced: true
}